<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const animal = {
        firstName: "chen",
        lastName: "jack",
        get fullName() {
          return `${this.lastName} ${this.firstName}`;
        },
        set fullName(value) {
          console.log(value);
          [this.lastName, this.firstName] = value.split(" ");
        },
      };
      const cat = {
        // firstName:'zhang',
        // lastName:'lili',
        __proto__: animal,
      };

      /*
      1. 在这里this===cat
      2. cat.lastName=lili, cat.firstName=zhang
      */
      // cat.setFullName('lili zhang');
      cat.fullName = "lili zhang";

      console.log("cat", cat.fullName);

      console.log(cat);
    </script>
  </body>
</html>
